<%@  Language="C#" %>
<%@ Assembly Name="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Assembly Name="Split.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d3fe7feb5c979421" %>
<%@ Import Namespace="System.Management.Automation" %>
<%@ Import Namespace="System.Management.Automation.Runspaces" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Split.Core"%>
<html>
<head>
    <title>SPLIT - SharePoint Log Investigation Tool</title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <link href="Styles/Site.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        $(
function ()
 {
    $("td:contains('Unexpected'), td:contains('Critical')").parent('tr').css({ 'color': 'red', 'font-weight': 'bold' });
    $("td:contains('High')").parent('tr').css({ 'color': 'blue' });
});
    </script>
</head>
<script runat="server" language="C#">       
    void btnGo_OnClick(Object sender, EventArgs e)
    {
        try
        {
            litError.Text = "";
            IList list = LogSearcher.GetLogFromCorrelation(txtCorrlationId.Text.Trim(), txtTimeSpan.Text.Trim());
            grdRunPSCommand.DataSource = list;
            grdRunPSCommand.DataBind();
        }
        catch (Exception ex)
        {
            litError.Text = ex.Message;
        }
    }
</script>
<body>
    <form id="form" runat="server">
    <div class="mainPanel">
        <div style="width: 100%;">
            <h1 class="h1Text">
                SPLIT - SharePoint Log Investigation Tool
            </h1>
        </div>
        
        <div class="row">
            <div class="lableStyle">
                Correlation ID :
            </div>
            <div style="float: left;">
                <asp:TextBox ID="txtCorrlationId" Text="" runat="server" Width="300px"></asp:TextBox>
            </div>
        </div>
        <div class="row">
            <div class="lableStyle">
                Span (in -minutes) :
            </div>
            <div style="float: left;">
                <asp:TextBox ID="txtTimeSpan" Text="-15" runat="server" Width="50px"></asp:TextBox>
                <asp:Button ID="btnGo" Text="Search" OnClick="btnGo_OnClick" runat="server"></asp:Button>
            </div>
        </div>
        <div class="row errText">
            <asp:Literal ID="litError" runat="server"></asp:Literal>
        </div>
        <div>
            <asp:GridView ID="grdRunPSCommand" runat="server" AutoGenerateColumns="False" CellPadding="4"
                EnableModelValidation="True" ForeColor="#333333" GridLines="Both">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="Timestamp" HeaderText="Timestamp" SortExpression="Timestamp" />
                    <asp:BoundField DataField="Process" HeaderText="Process" SortExpression="Process" />
                    <asp:BoundField DataField="ThreadID" HeaderText="ThreadID" SortExpression="ThreadID" />
                    <asp:BoundField DataField="Area" HeaderText="Area" SortExpression="Area" />
                    <asp:BoundField DataField="Category" HeaderText="Category" SortExpression="Category" />
                    <asp:BoundField DataField="EventID" HeaderText="EventID" SortExpression="EventID" />
                    <asp:BoundField DataField="Level" HeaderText="Level" SortExpression="Level" />
                    <asp:BoundField DataField="Message" HeaderText="Message" SortExpression="Message" />
                    <asp:BoundField DataField="Correlation" HeaderText="Correlation" SortExpression="Correlation" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            </asp:GridView>
        </div>
    </div>
    </form>
</body>
</html>
